package com.fr.report.write.config;

import com.fr.data.core.db.dialect.Dialect;
import com.fr.data.core.db.dialect.DialectFactory;
import com.fr.data.core.db.dml.Insert;
import com.fr.data.core.db.dml.Table;
import com.fr.report.script.Calculator;
import com.fr.report.script.Primitive;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Map;

public class InsertConfig extends DMLConfig
{
  public void dmlSubmit(Connection paramConnection, Calculator paramCalculator, Object[] paramArrayOfObject, Map paramMap)
    throws SQLException
  {
    int i = getColumnConfigCount();
    if ((i == 0) || (this.table == null))
      return;
    Dialect localDialect = DialectFactory.generateDialect(paramConnection);
    Insert localInsert = new Insert(this.table, localDialect);
    for (int j = 0; j < i; ++j)
    {
      ColumnConfig localColumnConfig = getColumnConfig(j);
      Object localObject = paramArrayOfObject[j];
      if ((localObject != null) && (localObject != Primitive.NULL))
      {
        if ((localObject instanceof String) && (((String)localObject).length() == 0))
          break label126:
        String str = localColumnConfig.getColumnName();
        int k = getColumnType(str, paramConnection);
        localInsert.addColumn(str, k, localObject);
      }
    }
    label126: localInsert.execute(paramConnection);
  }

  public String toString()
  {
    return "insert into " + this.table.toString() + " " + super.toString();
  }
}